package bj.yanchao.com.dagger2_example.view;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.TextView;

import javax.inject.Inject;

import bj.yanchao.com.dagger2_example.component.DaggerApplicationComponent;
import bj.yanchao.com.dagger2_example.model.DateRepository;
import bj.yanchao.com.dagger2_example.R;
import bj.yanchao.com.dagger2_example.YApplication;

/**
 * ${TODO} What the class does
 *
 * @author： yanchao
 * @date： 6/3/16-3:11 PM
 * ${TAGS}
 */
public class MainActivity extends Activity {
    @Inject
    DateRepository mDateRepository;
    @Inject
    SharedPreferences.Editor mEditor;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activty_main);
        ((YApplication) getApplication()).getApplicationComponent().inject(this);
        TextView l_textView = (TextView) findViewById(R.id.text);
        l_textView.setText(mDateRepository.getTitle());
        mEditor.putString("str", mDateRepository.getTitle());
        mEditor.commit();
    }
}
